﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Football.Models;
using System.Data;

namespace Football.Controllers
{
    public class PlayerController : Controller
    {

        FootballEntities footballDB = new FootballEntities();

        //
        // POST: /Player/Delete/5

        [HttpPost]
        public ActionResult ToggleStatus(int id)
        {
            try
            {
                var player = footballDB.GamePlayers.Find(id);

                player.GamePlayerStatusId = 2;
                
                footballDB.Entry(player).State = EntityState.Modified;
                footballDB.SaveChanges();

                return Json(new { id = id });
            }
            catch
            {
                return Json(new { id = 0 });
            }
        }
    }
}
